package com.avalon.erp.addon.estate.service;

import com.avalon.core.field.Field;
import com.avalon.core.field.Fields;
import com.avalon.core.model.SelectionHashMap;
import com.avalon.core.service.AbstractService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author lwlianghehe@gmail.com
 * @date 2025/6/8
 */
@Service
@Slf4j
public class EstatePropertyService extends AbstractService {
    @Override
    public String getServiceName() {
        return "estate.property";
    }

    @Override
    public String getLabel() {
        return "房地产";
    }

    public Field description = Fields.createString("描述");
    public Field postcode = Fields.createString("邮编");
    public Field dateAvailability = Fields.createDate("可用时间");
    public Field expectedPrice = Fields.createBigDecimal("期望价格");
    public Field sellingPrice = Fields.createBigDecimal("实际价格");
    public Field bedrooms = Fields.createInteger("房间数");
    public Field livingArea = Fields.createInteger("居住面积");
    public Field facades = Fields.createInteger("facades");
    public Field garage = Fields.createBoolean("车库");
    public Field garden = Fields.createBoolean("花园");
    public Field gardenArea = Fields.createInteger("花园面积");
    public Field gardenOrientation = Fields.createSelection("花园朝向", new SelectionHashMap() {{
        put("north", "北");
        put("south", "南");
        put("east", "东");
        put("west", "西");
    }});

    public Field propertyTypeId = Fields.createMany2one("房屋类型", "estate.property.type");

    public Field buyer = Fields.createMany2one("买家", "base.user");
    public Field seller = Fields.createMany2one("卖家", "base.user");

    public Field tagIds = Fields.createMany2many("房屋标签", "estate.property.tag",
            "estate.property.tag.ref", "propertyId", "tagId");

    public Field offerIds = Fields.createOne2many("报价单","estate.property.offer",
            "propertyId");
}
